/*
		Code Name: loki is an attempt to create an Operating System geared towards ham
		operators and there equipment.
		
		Copyright (C)2011  Joseph Rugar <ke5mkm@gmail.com>

    This program is free software: you can redistribute it and/or modify
    it under the terms of the GNU General Public License as published by
    the Free Software Foundation, either version 3 of the License, or
    (at your option) any later version.

    This program is distributed in the hope that it will be useful,
    but WITHOUT ANY WARRANTY; without even the implied warranty of
    MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
    GNU General Public License for more details.

    You should have received a copy of the GNU General Public License
    along with this program.  If not, see <http://www.gnu.org/licenses/>.
*/

#ifndef KERNEL_PROCESSOR_TYPES_H
#define KERNEL_PROCESSOR_TYPES_H

#include "x86/types.h"
#define PROCESSOR_SPECIFIC_NAME(x) X86##x

// NOTE: This throws a compile-time error if this header is not adapted for
// the selected processor architecture
#if !defined(PROCESSOR_SPECIFIC_NAME)
#error Unknown processor architecture
#endif

/** @addtogroup kernelprocessor
* @{ */

// NOTE: If a newly added processor architecture does not supply all the
// needed types, you will get an error here

/** Define an 8bit signed integer type */
typedef PROCESSOR_SPECIFIC_NAME(int8_t) int8_t;
/** Define an 8bit unsigned integer type */
typedef PROCESSOR_SPECIFIC_NAME(uint8_t) uint8_t;
/** Define an 16bit signed integer type */
typedef PROCESSOR_SPECIFIC_NAME(int16_t) int16_t;
/** Define an 16bit unsigned integer type */
typedef PROCESSOR_SPECIFIC_NAME(uint16_t) uint16_t;
/** Define a 32bit signed integer type */
typedef PROCESSOR_SPECIFIC_NAME(int32_t) int32_t;
/** Define a 32bit unsigned integer type */
typedef PROCESSOR_SPECIFIC_NAME(uint32_t) uint32_t;
/** Define a 64bit signed integer type */
typedef PROCESSOR_SPECIFIC_NAME(int64_t) int64_t;
/** Define a 64bit unsigned integer type */
typedef PROCESSOR_SPECIFIC_NAME(uint64_t) uint64_t;

/** Define a signed integer type for pointer arithmetic */
typedef PROCESSOR_SPECIFIC_NAME(intptr_t) intptr_t;
/** Define an unsigned integer type for pointer arithmetic */
typedef PROCESSOR_SPECIFIC_NAME(uintptr_t) uintptr_t;

/** Define a unsigned integer type for physical pointer arithmetic */
typedef PROCESSOR_SPECIFIC_NAME(physical_uintptr_t) physical_uintptr_t;

/** Define an unsigned integer type for processor registers */
typedef PROCESSOR_SPECIFIC_NAME(processor_register_t) processor_register_t;

/** Define ssize_t */
typedef PROCESSOR_SPECIFIC_NAME(ssize_t) ssize_t;
/** Define size_t */
typedef PROCESSOR_SPECIFIC_NAME(size_t) size_t;

// NOTE: This should be defined in the file included at the top of this file
// if this processor architecture does not support I/O ports
#if !defined(KERNEL_PROCESSOR_NO_PORT_IO)
  /** Define an I/O port type */
  typedef PROCESSOR_SPECIFIC_NAME(io_port_t) io_port_t;
#endif


/** @} */

#undef PROCESSOR_SPECIFIC_NAME

#endif
